package com.lsq.baseadmin.modules.setting.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lsq.baseadmin.modules.setting.entity.SystemSetting;
import com.lsq.baseadmin.modules.setting.mapper.SystemSettingMapper;
import com.lsq.baseadmin.modules.setting.service.SystemSettingService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统设置 服务实现类
 * </p>
 *
 * @author lsq
 * @since 2020-11-26
 */
@Service
public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, SystemSetting> implements SystemSettingService {

    @Override
    public List<SystemSetting> list(SystemSetting entity) {
    QueryWrapper<SystemSetting> wrapper = createWrapper(entity);
        return baseMapper.selectList(wrapper);
    }

    @Override
    public PageInfo pg(SystemSetting entity, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<SystemSetting> list = list(entity);
        return new PageInfo<>(list);
    }

    private QueryWrapper<SystemSetting> createWrapper(SystemSetting entity) {
        QueryWrapper<SystemSetting> wrapper = new QueryWrapper<>();
        if(null == entity) {
           return wrapper;
        }
        return wrapper;
    }

}

